package com.tedu.api.io.thread;

import org.testng.annotations.Test;

import java.util.Comparator;

/**
 *
 */
public class LambdaDemo {
    @Test
    public void LambdaHomework1() {
        //使用Lambda表达式完成Thread线程创建
        //Thread类Java定义线程类--具备启动start---
        //Thread类内嵌Runnable类--线程run运行
        Thread t1 = new Thread(() -> {
            for (int i = 0; 1 < 1000; i++) {
                System.out.println("给我学的一愣一愣的");
            }});
        t1.start();
    }
    @Test
    public void LambdaHomework2(){
        //1.创建Runnable接口--run()
        Runnable mr1=()->{for (int i=0;1<1000;i++){
            System.out.println("时间不等人");
        }};
        //2.创建Thread线程类--start()
        Thread t2=new Thread(mr1);
        //3.启动线程
        t2.start();
    }
    @Test
    public void LambdaHomework5(){
        class IntComparator implements Comparator<Integer> {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1 - o2;
               // Comparator<Integer> intComparator = (o1, o2) -> o1 - o2;
            }
        }
    }



}

